<template>
  <view class="video-management">
    <!-- 顶部导航 -->
    <view class="header">
      <view class="header-content">
        <text class="title">视频管理中心</text>
        <view class="admin-info">
          <image class="avatar" src="/static/default-avatar.png" mode="aspectFill" />
          <text class="admin-name">管理员</text>
        </view>
      </view>
      <view class="header-wave"></view>
    </view>

    <!-- 主内容区 -->
    <view class="main-content">
      <!-- 分类管理卡片 -->
      <view class="management-card">
        <view class="card-header">
          <uni-icons type="folder" size="24" color="#4a90e2"></uni-icons>
          <text class="card-title">视频分类管理</text>
        </view>
        
        <view class="form-group">
          <input
            v-model="newCategory.label"
            placeholder="分类名称（如：数学）"
            class="form-input"
          />
          <input
            v-model="newCategory.value"
            placeholder="分类值（如：math）"
            class="form-input"
          />
          <button 
            class="primary-button"
            @click="addCategory"
            :style="{backgroundColor: editingCategory ? '#FF9800' : '#4a90e2'}"
          >
            {{ editingCategory ? '更新分类' : '添加分类' }}
          </button>
        </view>
        
        <view class="category-list">
          <view
            v-for="category in categories"
            :key="category.value"
            class="category-item"
          >
            <view class="category-info">
              <text class="category-label">{{ category.label }}</text>
              <text class="category-value">{{ category.value }}</text>
            </view>
            <view class="category-actions">
              <button class="icon-button" @click="editCategory(category)">
                <uni-icons type="compose" size="20" color="#4a90e2"></uni-icons>
              </button>
              <button class="icon-button danger" @click="deleteCategory(category.value)">
                <uni-icons type="trash" size="20" color="#FF5252"></uni-icons>
              </button>
            </view>
          </view>
        </view>
      </view>

      <!-- 视频上传卡片 -->
      <view class="management-card">
        <view class="card-header">
          <uni-icons type="cloud-upload" size="24" color="#00b218"></uni-icons>
          <text class="card-title">视频上传</text>
        </view>
        
        <!-- 单视频上传 -->
        <view class="upload-section">
          <view class="section-title">
            <uni-icons type="videocam" size="18" color="#4a90e2"></uni-icons>
            <text>单视频上传</text>
          </view>
          
          <view class="form-group">
            <input
              v-model="newVideo.title"
              placeholder="视频标题"
              class="form-input"
            />
            <picker
              :range="categories"
              range-key="label"
              @change="selectVideoCategory"
              class="category-picker"
            >
              <view class="picker-content">
                <text>{{ newVideo.category_label || '选择分类' }}</text>
                <uni-icons type="arrowdown" size="16" color="#999"></uni-icons>
              </view>
            </picker>
            <input
              v-model="newVideo.duration"
              type="number"
              placeholder="视频时长（秒）"
              class="form-input"
            />
            <button class="upload-button" @click="chooseVideo">
              <uni-icons type="plus" size="18" color="#4a90e2"></uni-icons>
              <text>选择视频文件</text>
            </button>
            <button 
              class="primary-button"
              :disabled="uploading"
              @click="uploadVideo"
              :style="{backgroundColor: uploading ? '#ccc' : (editingVideo ? '#FF9800' : '#4a90e2')}"
            >
              {{ uploading ? '上传中...' : (editingVideo ? '更新视频' : '上传视频') }}
            </button>
          </view>
        </view>
        
        <!-- 批量上传 -->
        <view class="upload-section batch">
          <view class="section-title">
            <uni-icons type="videocam-filled" size="18" color="#9C27B0"></uni-icons>
            <text>批量上传</text>
          </view>
          
          <view class="form-group">
            <picker
              :range="categories"
              range-key="label"
              @change="selectBatchCategory"
              class="category-picker"
            >
              <view class="picker-content">
                <text>{{ batchVideos.category_label || '选择分类' }}</text>
                <uni-icons type="arrowdown" size="16" color="#999"></uni-icons>
              </view>
            </picker>
            
            <button class="upload-button batch" @click="chooseBatchVideos">
              <uni-icons type="plus-filled" size="18" color="#9C27B0"></uni-icons>
              <text>选择多个视频</text>
            </button>
            
            <!-- 批量视频列表 -->
            <view v-if="batchVideos.files.length > 0" class="batch-list">
              <view 
                v-for="(file, index) in batchVideos.files" 
                :key="index" 
                class="batch-item"
              >
                <view class="file-info">
                  <uni-icons type="play" size="16" color="#4a90e2"></uni-icons>
                  <text class="file-name">{{ file.name }}</text>
                </view>
                
                <view class="file-form">
                  <input
                    v-model="file.title"
                    placeholder="视频标题"
                    class="form-input small"
                  />
                  <input
                    v-model="file.duration"
                    type="number"
                    placeholder="时长（秒）"
                    class="form-input small"
                  />
                  <button class="icon-button danger" @click="removeBatchFile(index)">
                    <uni-icons type="close" size="16" color="#FF5252"></uni-icons>
                  </button>
                </view>
              </view>
            </view>
            
            <button
              class="primary-button batch"
              :disabled="batchUploading || batchVideos.files.length === 0"
              @click="uploadBatchVideos"
            >
              {{ batchUploading ? '批量上传中...' : '批量上传' }}
            </button>
          </view>
        </view>
      </view>

      <!-- 视频列表卡片 -->
      <view class="management-card">
        <view class="card-header">
          <uni-icons type="list" size="24" color="#9C27B0"></uni-icons>
          <text class="card-title">视频列表</text>
          <text class="video-count">{{ videos.length }}个视频</text>
        </view>
        
        <scroll-view scroll-y class="video-list">
          <view v-if="videos.length === 0" class="empty-state">
            <uni-icons type="info" size="48" color="#ccc"></uni-icons>
            <text>暂无视频数据</text>
          </view>
          
          <view 
            v-for="video in videos" 
            :key="video.id" 
            class="video-item"
          >
            <view class="video-thumbnail">
              <uni-icons type="play-circle-filled" size="48" color="#4a90e2"></uni-icons>
            </view>
            
            <view class="video-info">
              <text class="video-title">{{ video.title }}</text>
              <view class="video-meta">
                <text class="video-category">{{ video.category_label }}</text>
                <text class="video-duration">{{ formatDuration(video.duration) }}</text>
              </view>
            </view>
            
            <view class="video-actions">
              <button class="icon-button" @click="editVideo(video)">
                <uni-icons type="compose" size="20" color="#4a90e2"></uni-icons>
              </button>
              <button class="icon-button danger" @click="deleteVideo(video.id)">
                <uni-icons type="trash" size="20" color="#FF5252"></uni-icons>
              </button>
            </view>
          </view>
        </scroll-view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      categories: [],
      videos: [],
      newCategory: { label: '', value: '' },
      newVideo: {
        title: '',
        category: '',
        category_label: '',
        duration: '',
        filePath: ''
      },
      batchVideos: {
        category: '',
        category_label: '',
        files: []
      },
      uploading: false,
      batchUploading: false,
      editingCategory: null,
      editingVideo: null,
      userId: '',
      userRole: ''
    };
  },
  onLoad() {
    // 延迟检查以确保存储写入完成
    setTimeout(() => {
      this.loadUserData();
    }, 100);
  },
  methods: {
    loadUserData() {
      const user = uni.getStorageSync('user') || {};
      console.log('用户信息:', user);
      if (!user.id || user.role !== 'admin') {
        console.warn('权限检查失败，跳转到登录页', { id: user.id, role: user.role });
        uni.redirectTo({ url: '/pages/student/login' });
        return;
      }
      this.userId = user.id; // 设置 userId
      this.userRole = user.role; // 设置 userRole
      this.loadCategories();
      this.loadVideos();
    },
    // 加载分类
    async loadCategories() {
      try {
        const res = await uniCloud.callFunction({
          name: 'categoryManage',
          data: { action: 'get' }
        });
        if (res.result && res.result.code === 0) {
          this.categories = res.result.data || [];
        } else {
          uni.showToast({ title: res.result?.msg || '获取分类失败', icon: 'none' });
        }
      } catch (e) {
        console.error('获取分类失败:', e);
        uni.showToast({ title: '加载分类失败，请检查云函数', icon: 'none' });
      }
    },

    // 添加/更新分类
    async addCategory() {
      if (!this.newCategory.label || !this.newCategory.value) {
        return uni.showToast({ title: '请填写分类名称和值', icon: 'none' });
      }
      try {
        const action = this.editingCategory ? 'update' : 'add';
        const data = {
          action,
          label: this.newCategory.label,
          value: this.newCategory.value
        };
        if (this.editingCategory) {
          data.oldValue = this.editingCategory.value;
        }
        const res = await uniCloud.callFunction({
          name: 'categoryManage',
          data
        });
        if (res.result && res.result.code === 0) {
          uni.showToast({ title: this.editingCategory ? '更新成功' : '添加成功', icon: 'success' });
          this.newCategory = { label: '', value: '' };
          this.editingCategory = null;
          this.loadCategories();
        } else {
          uni.showToast({ title: res.result?.msg || '操作分类失败', icon: 'none' });
        }
      } catch (e) {
        console.error('操作分类失败:', e);
        uni.showToast({ title: '操作分类失败，请检查云函数', icon: 'none' });
      }
    },

    // 编辑分类
    editCategory(category) {
      this.newCategory = { ...category };
      this.editingCategory = category;
    },

    // 删除分类
    async deleteCategory(value) {
      uni.showModal({
        title: '确认删除',
        content: '删除分类可能影响现有视频，确认继续？',
        success: async (res) => {
          if (res.confirm) {
            try {
              const res = await uniCloud.callFunction({
                name: 'categoryManage',
                data: { action: 'delete', value }
              });
              if (res.result && res.result.code === 0) {
                uni.showToast({ title: '删除成功', icon: 'success' });
                this.loadCategories();
                this.loadVideos();
              } else {
                uni.showToast({ title: res.result?.msg || '删除分类失败', icon: 'none' });
              }
            } catch (e) {
              console.error('删除分类失败:', e);
              uni.showToast({ title: '删除分类失败，请检查云函数', icon: 'none' });
            }
          }
        }
      });
    },

    // 加载视频列表
    async loadVideos() {
      try {
        console.log('Calling videoManage with user_id:', this.userId);
        const res = await uniCloud.callFunction({
          name: 'videoManage',
          data: { action: 'get', category: '', user_id: this.userId }
        });
        console.log('videoManage response:', res);
        if (res.result && res.result.code === 0) {
          this.videos = res.result.data || [];
        } else {
          uni.showToast({ title: res.result?.msg || '获取视频列表失败', icon: 'none' });
        }
      } catch (e) {
        console.error('获取视频列表失败:', e);
        uni.showToast({ title: '加载视频列表失败，请检查云函数', icon: 'none' });
      }
    },

    // 选择单视频分类
    selectVideoCategory(e) {
      const index = parseInt(e.detail.value);
      if (this.categories[index]) {
        this.newVideo.category = this.categories[index].value;
        this.newVideo.category_label = this.categories[index].label;
      } else {
        uni.showToast({ title: '请选择有效分类', icon: 'none' });
      }
    },

    // 选择批量视频分类
    selectBatchCategory(e) {
      const index = parseInt(e.detail.value);
      if (this.categories[index]) {
        this.batchVideos.category = this.categories[index].value;
        this.batchVideos.category_label = this.categories[index].label;
      } else {
        uni.showToast({ title: '请选择有效分类', icon: 'none' });
      }
    },

    // 选择单视频文件
    chooseVideo() {
      uni.chooseVideo({
        sourceType: ['album', 'camera'],
        compressed: true,
        success: (res) => {
          this.newVideo.filePath = res.tempFilePath;
          if (!this.newVideo.duration) {
            this.newVideo.duration = Math.floor(res.duration);
          }
          uni.showToast({ title: '已选择视频', icon: 'success' });
        },
        fail: () => {
          uni.showToast({ title: '选择视频失败', icon: 'none' });
        }
      });
    },

    // 选择多个视频文件
    chooseBatchVideos() {
      uni.chooseMedia({
        count: 10,
        mediaType: ['video'],
        sourceType: ['album', 'camera'],
        success: (res) => {
          this.batchVideos.files = res.tempFiles.map(file => ({
            filePath: file.tempFilePath,
            name: file.tempFilePath.split('/').pop(),
            title: '',
            duration: Math.floor(file.duration || 0)
          }));
          uni.showToast({ title: `已选择 ${res.tempFiles.length} 个视频`, icon: 'success' });
        },
        fail: () => {
          uni.showToast({ title: '选择视频失败', icon: 'none' });
        }
      });
    },

    // 移除批量视频列表中的文件
    removeBatchFile(index) {
      this.batchVideos.files.splice(index, 1);
    },

    // 上传单视频
    async uploadVideo() {
      if (!this.userId || this.userRole !== 'admin') {
        uni.showToast({ title: this.userId ? '仅管理员可上传' : '请先登录', icon: 'none' });
        uni.navigateTo({ url: this.userId ? '/pages/home/home' : '/pages/student/login' });
        return;
      }
      if (!this.newVideo.title || !this.newVideo.category || !this.newVideo.duration || (!this.newVideo.filePath && !this.editingVideo)) {
        return uni.showToast({ title: '请填写完整信息并选择视频', icon: 'none' });
      }
      this.uploading = true;
      try {
        let url = this.editingVideo ? this.editingVideo.url : '';
        if (this.newVideo.filePath) {
          const uploadRes = await uniCloud.uploadFile({
            filePath: this.newVideo.filePath,
            cloudPath: `videos/${Date.now()}.mp4`
          });
          url = uploadRes.fileID;
        }
        const data = {
          action: this.editingVideo ? 'update' : 'add',
          title: this.newVideo.title,
          url,
          duration: parseInt(this.newVideo.duration),
          category: this.newVideo.category,
          category_label: this.newVideo.category_label,
          user_id: this.userId
        };
        if (this.editingVideo) {
          data.id = this.editingVideo.id;
        }
        console.log('Calling videoManage with data:', data);
        const res = await uniCloud.callFunction({
          name: 'videoManage',
          data
        });
        console.log('videoManage response:', res);
        if (res.result && res.result.code === 0) {
          uni.showToast({ title: this.editingVideo ? '更新成功' : '上传成功', icon: 'success' });
          this.newVideo = { title: '', category: '', category_label: '', duration: '', filePath: '' };
          this.editingVideo = null;
          this.loadVideos();
        } else {
          uni.showToast({ title: res.result?.msg || '上传视频失败', icon: 'none' });
        }
      } catch (e) {
        console.error('上传视频失败:', e);
        uni.showToast({ title: '上传视频失败，请检查云函数或存储', icon: 'none' });
      } finally {
        this.uploading = false;
      }
    },

    // 批量上传视频
    async uploadBatchVideos() {
      if (!this.userId || this.userRole !== 'admin') {
        uni.showToast({ title: this.userId ? '仅管理员可上传' : '请先登录', icon: 'none' });
        uni.navigateTo({ url: this.userId ? '/pages/home/home' : '/pages/student/login' });
        return;
      }
      if (!this.batchVideos.category || this.batchVideos.files.length === 0) {
        return uni.showToast({ title: '请选择分类并添加视频', icon: 'none' });
      }
      for (const file of this.batchVideos.files) {
        if (!file.title || !file.duration) {
          return uni.showToast({ title: `请填写 ${file.name} 的完整信息`, icon: 'none' });
        }
      }
      this.batchUploading = true;
      try {
        const videos = [];
        for (const file of this.batchVideos.files) {
          const uploadRes = await uniCloud.uploadFile({
            filePath: file.filePath,
            cloudPath: `videos/${Date.now()}_${file.name}`
          });
          videos.push({
            title: file.title,
            url: uploadRes.fileID,
            duration: parseInt(file.duration),
            category: this.batchVideos.category,
            category_label: this.batchVideos.category_label,
            user_id: this.userId
          });
        }
        const data = { action: 'batchAdd', videos };
        console.log('Calling videoManage with data:', data);
        const res = await uniCloud.callFunction({
          name: 'videoManage',
          data
        });
        console.log('videoManage response:', res);
        if (res.result && res.result.code === 0) {
          uni.showToast({ title: `成功上传 ${videos.length} 个视频`, icon: 'success' });
          this.batchVideos = { category: '', category_label: '', files: [] };
          this.loadVideos();
        } else {
          uni.showToast({ title: res.result?.msg || '批量上传失败', icon: 'none' });
        }
      } catch (e) {
        console.error('批量上传失败:', e);
        uni.showToast({ title: '批量上传失败，请检查云函数或存储', icon: 'none' });
      } finally {
        this.batchUploading = false;
      }
    },

    // 编辑视频
    editVideo(video) {
      this.newVideo = { ...video, filePath: '' };
      this.editingVideo = video;
      uni.pageScrollTo({ scrollTop: 0, duration: 300 });
    },

    // 删除视频
    async deleteVideo(id) {
      uni.showModal({
        title: '确认删除',
        content: '确认删除该视频？',
        success: async (res) => {
          if (res.confirm) {
            try {
              const data = { action: 'delete', id, user_id: this.userId };
              console.log('Calling videoManage with data:', data);
              const res = await uniCloud.callFunction({
                name: 'videoManage',
                data
              });
              console.log('videoManage response:', res);
              if (res.result && res.result.code === 0) {
                uni.showToast({ title: '删除成功', icon: 'success' });
                this.loadVideos();
              } else {
                uni.showToast({ title: res.result?.msg || '删除视频失败', icon: 'none' });
              }
            } catch (e) {
              console.error('删除视频失败:', e);
              uni.showToast({ title: '删除视频失败，请检查云函数', icon: 'none' });
            }
          }
        }
      });
    },

    // 格式化视频时长
    formatDuration(seconds) {
      const mins = Math.floor(seconds / 60);
      const secs = seconds % 60;
      return `${mins}:${secs < 10 ? '0' : ''}${secs}`;
    }
  }
};
</script>

<style scoped>
.video-management {
  background-color: #f8f9fa;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* 顶部导航 */
.header {
  background: linear-gradient(135deg, #4a90e2, #5aa1ff);
  padding: 40rpx 30rpx 80rpx;
  color: white;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 40rpx 40rpx;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
  position: relative;
}

.title {
  font-size: 20px;
  font-weight: 600;
}

.admin-info {
  display: flex;
  align-items: center;
}

.avatar {
  width: 80rpx;
  height: 80rpx;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.8);
}

.admin-name {
  margin-left: 10px;
  font-size: 14px;
}

.header-wave {
  position: absolute;
  bottom: -20rpx;
  left: 0;
  right: 0;
  height: 40rpx;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 120" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" fill="%23f8f9fa" opacity=".25"/></svg>');
  background-size: cover;
}

/* 主内容区 */
.main-content {
  padding: 20rpx 30rpx;
  margin-top: -40rpx;
  position: relative;
  z-index: 2;
}

/* 管理卡片 */
.management-card {
  background: #fff;
  border-radius: 16rpx;
  padding: 30rpx;
  margin-bottom: 30rpx;
  box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.05);
}

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 24rpx;
  padding-bottom: 20rpx;
  border-bottom: 1px solid #f0f0f0;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-left: 10px;
}

.video-count {
  margin-left: auto;
  font-size: 12px;
  color: #999;
}

/* 表单组 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 20rpx;
}

.form-input {
  background: #f8f9fa;
  border-radius: 12rpx;
  padding: 20rpx;
  font-size: 14px;
  color: #333;
  border: 1px solid #e0e0e0;
}

.form-input.small {
  padding: 12rpx 20rpx;
  font-size: 13px;
}

/* 按钮 */
.primary-button {
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 12rpx;
  padding: 20rpx;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s;
}

.primary-button.batch {
  background-color: #9C27B0;
}

.primary-button:disabled {
  opacity: 0.6;
}

.upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8rpx;
  background: #f8f9fa;
  border: 1px dashed #4a90e2;
  border-radius: 12rpx;
  padding: 20rpx;
  color: #4a90e2;
  font-size: 14px;
}

.upload-button.batch {
  border-color: #9C27B0;
  color: #9C27B0;
}

.icon-button {
  width: 60rpx;
  height: 60rpx;
  border-radius: 50%;
  background: rgba(74, 144, 226, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}

.icon-button.danger {
  background: rgba(255, 82, 82, 0.1);
}

/* 分类列表 */
.category-list {
  margin-top: 20rpx;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx;
  margin-bottom: 16rpx;
  background: #f8f9fa;
  border-radius: 12rpx;
}

.category-info {
  flex: 1;
}

.category-label {
  font-size: 15px;
  font-weight: 500;
  display: block;
}

.category-value {
  font-size: 12px;
  color: #999;
}

.category-actions {
  display: flex;
  gap: 10rpx;
}

/* 上传区域 */
.upload-section {
  margin-top: 30rpx;
  padding-top: 30rpx;
  border-top: 1px solid #f0f0f0;
}

.upload-section.batch {
  border-top: 1px dashed #9C27B0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8/ActionButtonrpx;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 20rpx;
  color: #333;
}

/* 批量上传列表 */
.batch-list {
  margin-top: 20rpx;
  border: 1px dashed #e0e0e0;
  border-radius: 12rpx;
  padding: 20rpx;
}

.batch-item {
  margin-bottom: 20rpx;
  padding-bottom: 20rpx;
  border-bottom: 1px solid #f0f0f0;
}

.batch-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10rpx;
  margin-bottom: 10rpx;
}

.file-name {
  font-size: 13px;
  color: #555;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-form {
  display: flex;
  gap: 10rpx;
  align-items: center;
}

/* 视频列表 */
.video-list {
  max-height: 600rpx;
}

.video-item {
  display: flex;
  align-items: center;
  padding: 20rpx;
  margin-bottom: 20rpx;
  background: #f8f9fa;
  border-radius: 12rpx;
}

.video-thumbnail {
  width: 100rpx;
  height: 100rpx;
  border-radius: 8rpx;
  background: rgba(74, 144, 226, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20rpx;
}

.video-info {
  flex: 1;
}

.video-title {
  font-size: 15px;
  font-weight: 500;
  display: block;
  margin-bottom: 6rpx;
}

.video-meta {
  display: flex;
  gap: 20rpx;
}

.video-category, .video-duration {
  font-size: 12px;
  color: #999;
}

.video-actions {
  display: flex;
  gap: 10rpx;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60rpx;
  color: #999;
  font-size: 14px;
}

/* 分类选择器 */
.category-picker {
  background: #f8f9fa;
  border-radius: 12rpx;
  border: 1px solid #e0e0e0;
}

.picker-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20rpx;
  font-size: 14px;
}
</style>